import JSEncrypt from 'jsencrypt';

const publicKey = `MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALT2VDX8KK/hK9RjNeL+LeHUVhzPvwZI
BaZzaG0s0vTuJKNVw74THf5SbFQQCMHifdfI7WUUA6oApV2/Q78TfUsCAwEAAQ==`

const privateKey = `MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAtPZUNfwor+Er1GM1
4v4t4dRWHM+/BkgFpnNobSzS9O4ko1XDvhMd/lJsVBAIweJ918jtZRQDqgClXb9D
vxN9SwIDAQABAkAQ+o+6JPeYUPMw0UIsExcw+iA+Qcu1hippjKh+ndcJPepnL+Rv
ozGBSiBT/bbjHhCwAiFF4k9AI2FPSgIQve6RAiEA4mUqxUpXFaucUSa/tbgADk9S
pf3+pHGM39RsMLNrv2kCIQDMoD4T1EveK6zWhQhDWZ0AFDsbZW+AV3FBSGfgQ5F0
kwIhAK3Jgx+XhWn5JjGVUSypZkGV2pfZdhO9pqpbYgGweVGhAiAQz3lKF77D2cKx
POyY29vSDddtQMAQQx7CxjgCbIqekQIhAIiPt3MdKU/tB1CnsAoOMTZ/PnbDzHuK
dkI3TImdqdwL`

// 加密
export function encrypt(txt) {
    const encryptor = new JSEncrypt()
    encryptor.setPublicKey(publicKey) // 设置公钥
    return encryptor.encrypt(txt) // 对数据进行加密
}

// 解密
export function decrypt(txt) {
    const encryptor = new JSEncrypt()
    encryptor.setPrivateKey(privateKey) // 设置私钥
    return encryptor.decrypt(txt) // 对数据进行解密
}